<?php

namespace App\Http\Controllers\Kms\App\System;

use App\Http\Controllers\BaseController;
use App\Http\Validate\Kms\System\SystemValidate;
use App\Service\Kms\System\SystemService;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

class SystemController extends BaseController
{
    /**
     * @param Request $request
     * @return JsonResponse
     * @throws ValidationException
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface|GuzzleException
     */
    public function watermark(Request $request): JsonResponse
    {
        $params = SystemValidate::watermarkValidate($request->all());
        return $this->success(SystemService::watermark($params));
    }

    /**
     * @return JsonResponse
     */
    public function config(): JsonResponse
    {
        return $this->success(SystemService::config());
    }

    /**
     * @return JsonResponse
     * @throws ValidationException
     */
    public function loginIndexTabAuth(): JsonResponse
    {
        return $this->success(SystemService::loginIndexTabAuth());
    }
}
